import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/login/login.vue'

Vue.use(Router)

export default new Router({
  // mode:"history",
  routes: [
    {
      path:"/",
      redirect:"/login"
    },{
      path: '/login',
      component: Login
    },{
      path: '/login/:type',
      component: Login
    },{
      path:"/what?",
      redirect:"/homepage",
      component:() => import('./components/model/model.vue'),
      children:[
        {
          path:"/homepage",
          component:() => import('./views/homepage/homepage.vue'),
          meta:{
            keepAlive:true
          }
        },{
          path:"/windshop",
          alias:["/watershop","/electricshop","/fireshop"],
          component:() => import('./views/windShop/windShops.vue'),
          meta:{
            keepAlive:true
          }
        },{
          path:"/purchase",
          component:() => import('./views/purchase/purchase.vue'),
          meta:{
            keepAlive:true
          }
        },{
          path:"/shops",
          component:() => import('./views/shops/shops.vue'),
          meta:{
            keepAlive:true
          }
        },{
          path:"/productDetails",
          component:() => import('./views/productDetails/productDetails.vue'),
          meta:{
            keepAlive:true
          }
        }
      ],
      beforeEnter:function(to,from,next){
        to.meta.keepAlive=to.path.split("/").length<from.path.split("/").length
        next()
      }
    },{
      path:"/center",
      redirect:"/center/buyer/purchase/specify",
      component:() => import('./views/center/model/model.vue'),
      children:[
        {
          path:"buyer",
          redirect:'/center/buyer/purchase/specify',
          component:() => import('./views/center/buyer/buyer.vue'),
          children:[
            {
              path:'purchase/specify',
              alias:["purchase/realbills","orders/others","orders/selfSupport","/center/seller/offerManage/myoffer","/center/seller/myorder/orderManage","/center/seller/product/productList","/center/mycenter/news/newscenter",'/center/mycenter/address/manage','/center/mycenter/integral/myintegral'],
              component:() => import('./views/center/buyer/specify/specify.vue'),
            },{
              path:'purchase/specify/detail',
              alias:["purchase/realbills/detail",],
              component:() => import('./views/center/buyer/specify/detail/detail.vue'),
            },{
              path:"orders/others/detail",
              alias:["orders/selfSupport/detail","/center/seller/myorder/orderManage/detail"],
              component:() => import('./views/center/buyer/orderDetail/orderdetail.vue'),
            },{
              path:'survey/overview',//采购总览
              component:() => import('./views/center/buyer/overview/overview.vue'),
            },{
              path:"/center/seller/shopManage/myshop",//我的店铺
              component:() => import('./views/center/seller/myShops/myShops.vue'),
            },{
              path:'/center/seller/shopManage/shopview',
              component:() => import('./views/center/seller/shopview/shopview.vue'),
            },{
              path:"/center/seller/offerManage/myoffer/detail",//报价详情
              component:()=>import('./views/center/seller/myoffer/myoffer.vue')
            },{
              path:"/center/mycenter/baseinfo",
              component:()=>import('./views/center/center/baseinfo/baseinfo.vue'),
            },{
              path:"/center/mycenter/password",
              component:()=>import('./views/center/center/password/password.vue'),
            },{
              path:"/center/mycenter/companyManage/identify",
              component:()=>import('./views/center/center/company/identify.vue'),
            },{
              path:"/center/seller/product/newproduct",
              alias:["/center/seller/product/productList/detail"],
              component:()=>import('./views/center/seller/product/newProduct/newProduct.vue'),
            }
          ]
        }
      ],
    }
  ]
})
